<th:block th:replace="~{base::html (head=null,content=~{::#signinForm})}">
  <div>
    <form id="signinForm">
      <div class="form-group">
        <p id="error" class="text-danger"></p>
      </div>
      <div class="form-group">
        <label>Email</label>
        <input id="email" type="email" class="form-control" placeholder="Email">
      </div>
      <div class="form-group">
        <label>Password</label>
        <input id="password" type="password" class="form-control" placeholder="Password">
      </div>
      <button type="submit" class="btn btn-outline-primary">Submit</button>
    </form>
  </div>
</th:block>
<script th:inline="javascript">
  console.log("...........")
  $(function () {
    $('#signinForm').submit(function (e) {
      e.preventDefault();
      var data = {
        email: $('#email').val(),
        password: $('#password').val()
      };
      $.ajax({
        type: 'POST',
        url: '/signin',
        data: JSON.stringify(data),
        success: function (resp) {
          if (resp.error) {
            $('#error').text(resp.error);
          } else {
            location.assign('/');
          }
        },
        contentType: 'application/json',
        dataType: 'json'
      });
    });
  });
</script>





